package action.AdminAction;

import java.util.Map;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

import domain.AdminValue;

public class AdminLogin extends ActionSupport{
	@Override
	public String execute() throws Exception {
		if (admin.getAdmin_Login() != null
				&& admin.getAdmin_Login().trim().equals("admin")
				&& admin.getAdmin_Pwd()!= null
				&& admin.getAdmin_Pwd().trim().equals("admin")) {
			HttpSession session=ServletActionContext.getRequest().getSession();
			session.setAttribute("Admin_Login", admin);
			return SUCCESS;
		} else {
			return "Admin_LOGIN";
		}
	}

	AdminValue admin;

	public AdminValue getAdmin() {
		return admin;
	}

	public void setAdmin(AdminValue admin) {
		this.admin = admin;
	}
}
